package com.huarui.part.action;

import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;
import org.ewaf.framework.action.BaseAction;
import org.ewaf.framework.model.ListModel;

import com.huarui.part.model.PartUpload;
import com.huarui.part.service.PartUploadService;
import com.huarui.user.model.SessionMessage;
import com.huarui.user.security.UserHolder;

public class PartUploadItemsAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2488260115526712711L;

	private static final Logger logger = Logger
			.getLogger(PartUploadAddAction.class);

	private PartUploadService partUploadService;

	private int start;

	private int limit=20;

	private Map<String, Object> resultMap;

	public String listWithComId() {

		SessionMessage sm = UserHolder.getCurrentSessionMessage();

		ListModel<PartUpload> lm = new ListModel<PartUpload>();
		lm.setPageSize(limit);
		lm.setStart(start);
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("companyId", sm.getCompanyId());
		lm = partUploadService.getPartUploadListByComId(lm, sm.getCompanyId(),
				map);
		resultMap = new HashMap<String, Object>();
		resultMap.put("totalProperty", lm.getTotal());
		resultMap.put("page", lm.getPage());
		resultMap.put("root", lm.getResult());
		return JSON;
	}

	public int getStart() {
		return start;
	}

	public void setStart(int start) {
		this.start = start;
	}

	public int getLimit() {
		return limit;
	}

	public void setLimit(int limit) {
		this.limit = limit;
	}

	public Map<String, Object> getResultMap() {
		return resultMap;
	}

	public void setResultMap(Map<String, Object> resultMap) {
		this.resultMap = resultMap;
	}

	public void setPartUploadService(PartUploadService partUploadService) {
		this.partUploadService = partUploadService;
	}

}
